*Replication code for Dotan Haim, Matthew Nanes, and Michael Davidson, "Family Matters: The Double-Edged Sword of Police-Community Connections." Journal of Politics.
*Code intended for Stata 13. Corresponding author Matthew Nanes, matthew.nanes@slu.edu

* ----------------------- MAIN PAPER ----------------------- *

cd "YOUR DIRECTORY WHERE YOU UNZIPPED THIS FILE"

use "Haim et al JOP Replication - Dyadic Level.dta"

* ---------------------------- * 
* --------- Table 1 ---------- * 
* ---------------------------- * 

xtset id_respondent
eststo clear
eststo: xtreg tanod_trustS log_geodist i.id_tanod, fe cl(psgc)
eststo: xtreg tanod_reportS log_geodist i.id_tanod, fe cl(psgc)
eststo: xtreg tanod_fairS log_geodist i.id_tanod, fe cl(psgc)
eststo: xtreg tanod_interactS log_geodist i.id_tanod, fe cl(psgc)
eststo: xtreg tanod_knowS log_geodist i.id_tanod, fe cl(psgc)
*esttab using "TabTanoddyadicS.tex", se star(* .10 ** .05 *** .01) nodep r2 keep(log_geodist) mtitle("Trust" "Report" "Fair" "Interact" "Know") label title(Family Ties and Citizen Perceptions of Tanods\label{dyadicresults}) note(OLS with respondent-clustered SE. Respondent and tanod fixed effects.) replace


use "Haim et al JOP Replication - Individual Level.dta"

* ---------------------------- * 
* --------- Table 2 ---------- * 
* ---------------------------- * 
****  DV: Satisfaction w/ Tanods | Embeddedness measure: Tanod Degree **** 
* Question text: How well do the Tanods protect public safety in your barangay?
xtset psgc
eststo clear
eststo: ologit satis_tanod embeddegreetnd connectavecivtnd connect_embed logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic distance, cl(psgc)
eststo: meologit satis_tanod embeddegreetnd connectavecivtnd connect_embed logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic distance || psgc: , vce(cluster psgc)
eststo: ologit satis_tanod embeddegreetnd connectavecivtnd connect_embed logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic degree age education employedft resideyears religioncatholic sampleprimary sampleproxy distance, cl(psgc)
eststo: ologit satis_tanod embeddegreetnd connectmincivtnd connectmin_embed embeddegreecap connectcivcap connect_embedcap logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic degree age education employedft resideyears religioncatholic sampleprimary sampleproxy distance, cl(psgc)
*esttab using "TabSatisNEW_2.tex", se star(* .10 ** .05 *** .01) order(embeddegreetnd connectavecivtnd connect_embed connectmincivtnd connectmin_embed) keep(embeddegreetnd connectavecivtnd connect_embed connectmincivtnd connectmin_embed logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic) nodep mtitle("" "" "" "") label title(Heterogeneous Effects on Evaluations of Tanod Service Provision\label{tab:satistanod}) note(Coefficients from ordered logistic regression with barangay-clustered SE.) replace

* ---------------------------- * 
* --------- Figure 3 --------- * 
* ---------------------------- * 
 
ssc install blindschemes
set scheme plotplainblind

ologit satis_tanod c.embeddegreetnd##c.connectavecivtnd logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic distance, cl(psgc)
qui margins, predict(outcome(2)) at(connectavecivtnd=(0(1)18) embeddegreetnd=14.1 (median) logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic) saving(embeddegree10pos, replace)
qui margins, predict(outcome(2)) at(connectavecivtnd=(0(1)18) embeddegreetnd=64.5 (median) logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic) saving(embeddegree90pos, replace)
combomarginsplot embeddegree10pos embeddegree90pos, labels("Low Embeddedness" "High Embeddedness") recastci(rarea) xtitle("Social Distance to Tanods") ytitle("Prob. Highly Satisfied") title("") xlabel(0(3)18) ylabel(0(0.2)1.0)

* ------------------ * 
* ---- Table 3 ----- * 
* ------------------ * 		

xtset psgc
eststo clear
eststo: xtlogit issues_victim_feud embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_neighbor embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_juv embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_theft embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
*esttab using "TabCrimeNEW_2.tex", se star(* .10 ** .05 *** .01) order(embeddegreetnd embeddegreecap) keep(embeddegreetnd embeddegreecap age education employedft income6 resideyears) nodep mtitle("Family" "Neighbor" "Delinquency" "Theft") label title(Tanod Embeddedness and Crime\label{Crime}) note(Logit with barangay random effects. Barangay-clustered standard errors in parentheses.) replace


* ------------------------- APPENDIX ------------------------- *


* Appendix B: Summary Statistics *

*Figure B.1: Distribution of Proximity and Embeddedness
hist connectavecivtnd, title(Distance to Nearest Tanod) saving(hist_socialdist)  
hist embeddegreetnd, title(Barangay Tanod Embeddedness) saving(hist_bgyembed)
gr combine hist_socialdist.gph hist_bgyembed.gph, col(2) xsize(6.5) ysize(3.5)

*Table B.1: Summary Statistic - Surveys
sum age
sum education
sum income6
sum resideyears
sum employedft

*Table B.2: Summary Statistics - Study Barangays
sum numtanodsbgy 
sum c10population4
sum c10hhsize
sum c10education
sum c10catholic
sum logavgpathlengthbgy
sum degree
sum c10male
sum c10ofw
sum c10age18_39

* Appendix C: Tanod Selection and Balance
* Section: Selection Process and Correlates of Embeddedness

*Table C.1: Predictors of Barangay-Level Tanod Embeddedness
eststo clear
eststo: reg embeddegreetnd c10population c10male c10hhsize c10ofw c10education c10age18_39 c10catholic c10ip embeddegreecap elec_captainmargin logavgpathlengthbgy, robust
*esttab using "PredBgyEmbed.tex", se star(* .10 ** .05 *** .01) nodep mtitle("") label title(Predictors of Tanod Embeddedness\label{tab:predbgyembed}) note(OLS regression with robust standard errors) replace

* Section: Local Politics

* Table C.4 *
cor embeddegreetnd embeddegreecap embeddegreekag embeddegreecaploser embeddegreekagloser

* Table C.5
xtset psgc
eststo clear
eststo: xtlogit issues_victim_feud embeddegreetnd embeddegreecap embeddegreekag age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_neighbor embeddegreetnd embeddegreecap embeddegreekag age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy densitybgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_juv embeddegreetnd embeddegreecap embeddegreekag age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_theft embeddegreetnd embeddegreecap embeddegreekag age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy densitybgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
*esttab using "RobCrimeKag.tex", se star(* .10 ** .05 *** .01) order(embeddegreetnd embeddegreecap embeddegreekag) keep(embeddegreetnd embeddegreecap embeddegreekag age education employedft income6 resideyears) nodep mtitle("Family" "Neighbor" "Delinquency" "Theft") label title(Tanod Embeddedness and Crime\label{RobCrimeKag}) note(Logit with barangay random effects. Barangay-clustered standard errors in parentheses.) replace

* Table C.6
xtset psgc
eststo clear
eststo: xtlogit issues_victim_feud embeddegreetnd connectavetndcap connecttndcap_embed age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_neighbor embeddegreetnd connectavetndcap connecttndcap_embed age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy densitybgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_juv embeddegreetnd connectavetndcap connecttndcap_embed age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_theft embeddegreetnd connectavetndcap connecttndcap_embed age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy densitybgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
*esttab using "RobCrimeCapTnd.tex", se star(* .10 ** .05 *** .01) order(embeddegreetnd connectavetndcap connecttndcap_embed) keep(embeddegreetnd connectavetndcap connecttndcap_embed age education employedft income6 resideyears) nodep mtitle("Family" "Neighbor" "Delinquency" "Theft") label title(Tanod Embeddedness and Crime\label{RobCrimeCapTnd}) note(Logit with barangay random effects. Barangay-clustered standard errors in parentheses.) replace


* Appendix D: Network Measures *

* Table D.1
eststo clear
eststo: ologit satis_tanod embeddegreetnd connectavecivtnd connect_embed densitybgy logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic degree, cl(psgc)	
eststo: ologit satis_tanod embeddegreetnd connectavecivtnd connect_embed transitivitybgy logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic degree, cl(psgc)
eststo: ologit satis_tanod embeddegreetnd connectavecivtnd connect_embed concentrationbgy logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic degree, cl(psgc)
*esttab using "Rob2networkstructure.tex", se star(* .10 ** .05 *** .01) order(embeddegreetnd connectavecivtnd connect_embed logavgpathlengthbgy densitybgy transitivitybgy concentrationbgy) keep(embeddegreetnd connectavecivtnd connect_embed logavgpathlengthbgy densitybgy transitivitybgy concentrationbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic) nodep mtitle("" "" "") label title(Robustness to Controlling for Network Structure\label{tab:robsatisnetwork}) note(Ordered logit with Barangay-clustered SE. Corresponds to Table 2 in text.) replace

* Table D.2
eststo clear
eststo: xtlogit issues_victim_feud embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree densitybgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_feud embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree transitivitybgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_feud embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree concentrationbgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
	* DV: Neighbor Disputes
eststo: xtlogit issues_victim_neighbor embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree densitybgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_neighbor embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree transitivitybgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_neighbor embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree concentrationbgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
*esttab using "RobCrimeNetwork.tex", se star(* .10 ** .05 *** .01) order(embeddegreetnd embeddegreecap logavgpathlengthbgy densitybgy transitivitybgy concentrationbgy) keep(embeddegreetnd embeddegreecap logavgpathlengthbgy densitybgy transitivitybgy concentrationbgy) nodep mtitle("Family" "Family" "Family" "Neighbor" "Neighbor" "Neighbor") label title(Tanod Embeddedness and Crime\label{RobCrimeNetwork}) note(Logit with barangay RE. Barangay-clustered SE. Includes all controls from Table 3.) replace


* NOT INCLUDED IN THE APPENDIX, BUT MENTIONED IN APPENDIX TEXT
	* DV: Juvenile Delinquency
xtlogit issues_victim_juv embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree densitybgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
xtlogit issues_victim_juv embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree transitivitybgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
xtlogit issues_victim_juv embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree concentrationbgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
xtlogit issues_victim_juv embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree modularitybgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
	* DV: Theft
xtlogit issues_victim_theft embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree densitybgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
xtlogit issues_victim_theft embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree transitivitybgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
xtlogit issues_victim_theft embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree concentrationbgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
xtlogit issues_victim_theft embeddegreetnd embeddegreecap age education employedft income6 resideyears numtanodsbgy degree modularitybgy logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)

*Table D.3
xtset psgc
eststo clear
eststo: xtlogit issues_victim_feud embeddegreetnd uncon_more4_ave embedtnd_uncon4 embeddegreecap age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_neighbor embeddegreetnd uncon_more4_ave embedtnd_uncon4 embeddegreecap age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy densitybgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_juv embeddegreetnd uncon_more4_ave embedtnd_uncon4 embeddegreecap age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_theft embeddegreetnd uncon_more4_ave embedtnd_uncon4 embeddegreecap age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy densitybgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
*esttab using "RobCrimeAlt1.tex", se star(* .10 ** .05 *** .01) keep(embeddegreetnd uncon_more4_ave embedtnd_uncon4 embeddegreecap age education employedft income6 resideyears) nodep mtitle("Family" "Neighbor" "Delinquency" "Theft") label title(Tanod Embeddedness and Crime\label{RobCrimeAlt1}) note(Logit with barangay random effects. Barangay-clustered standard errors in parentheses.) replace

*Table D.4
xtset psgc
eststo clear
eststo: xtlogit issues_victim_feud embeddegreetnd uncon_gini_ave embedtnd_uncongini embeddegreecap age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_neighbor embeddegreetnd uncon_gini_ave embedtnd_uncongini embeddegreecap age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy densitybgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_juv embeddegreetnd uncon_gini_ave embedtnd_uncongini embeddegreecap age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
eststo: xtlogit issues_victim_theft embeddegreetnd uncon_gini_ave embedtnd_uncongini embeddegreecap age education employedft income6 resideyears numtanodsbgy degree logavgpathlengthbgy densitybgy c10population4 c10male c10hhsize c10ofw c10education c10catholic c10age18_39, vce(cl psgc)
esttab using "RobCrimeAlt2.tex", se star(* .10 ** .05 *** .01) keep(embeddegreetnd uncon_gini_ave embedtnd_uncongini embeddegreecap age education employedft income6 resideyears) nodep mtitle("Family" "Neighbor" "Delinquency" "Theft") label title(Tanod Embeddedness and Crime\label{RobCrimeAlt2}) note(Logit with barangay random effects. Barangay-clustered standard errors in parentheses.) replace
	margins, dydx(uncon_gini_ave) at(embeddegreetnd=(14.1 64.5)) vsquish

	
* Appendix E: Robustness Checks *

use "Haim et al JOP Replication - Dyadic Level.dta", replace

** Subset to High and Low Embeddedness
	sum embed_degree_bgy, detail
	label variable log_geodist "Social Distance"

*Table E.1
	xtset id_respondent
	eststo clear
	eststo: xtreg tanod_trustS log_geodist i.id_tanod if embed_degree_bgy > 32.1, fe cl(psgc) 
	eststo: xtreg tanod_reportS log_geodist i.id_tanod if embed_degree_bgy > 32.1, fe cl(psgc)
	eststo: xtreg tanod_fairS log_geodist i.id_tanod if embed_degree_bgy > 32.1, fe cl(psgc)
	eststo: xtreg tanod_interactS log_geodist i.id_tanod if embed_degree_bgy > 32.1, fe cl(psgc)
	eststo: xtreg tanod_knowS log_geodist i.id_tanod if embed_degree_bgy > 32.1, fe cl(psgc)
	*esttab using "TabTanoddyadicShigh.tex", se star(* .10 ** .05 *** .01) nodep r2 keep(log_geodist) mtitle("Trust" "Report" "Fair" "Interact" "Know") label title(Family Ties and Perceptions of Tanods, High Embeddedness\label{dyadicresultshigh}) note(OLS with respondent-clustered SE. Respondent and tanod fixed effects.) replace

*Table E.2
	xtset id_respondent
	eststo clear
	eststo: xtreg tanod_trustS log_geodist i.id_tanod if embed_degree_bgy < 32.1, fe cl(psgc) 
	eststo: xtreg tanod_reportS log_geodist i.id_tanod if embed_degree_bgy < 32.1, fe cl(psgc)
	eststo: xtreg tanod_fairS log_geodist i.id_tanod if embed_degree_bgy < 32.1, fe cl(psgc)
	eststo: xtreg tanod_interactS log_geodist i.id_tanod if embed_degree_bgy < 32.1, fe cl(psgc)
	eststo: xtreg tanod_knowS log_geodist i.id_tanod if embed_degree_bgy < 32.1, fe cl(psgc)
	*esttab using "TabTanoddyadicSlow.tex", se star(* .10 ** .05 *** .01) nodep r2 keep(log_geodist) mtitle("Trust" "Report" "Fair" "Interact" "Know") label title(Family Ties and Perceptions of Tanods, Low Embeddedness\label{dyadicresultslow}) note(OLS with respondent-clustered SE. Respondent and tanod fixed effects.) replace

	* MAIN TAKEAWAY: The relationships are MUCH (3x at least) stronger in barangays w/ High embeddedness overall. 
	
*Table E.3
	tab psgc, gen(bar)
	tab id_tanod, gen(tnd)
	
	eststo clear
	eststo: cgmwildboot tanod_trustS log_geodist tnd* bar*, cl(psgc) bootcluster(id_tanod) seed(1989) reps(150)
	eststo: cgmwildboot tanod_reportS log_geodist tnd* bar*, cl(psgc) bootcluster(id_tanod) seed(1989) reps(150)
	eststo: cgmwildboot tanod_fairS log_geodist tnd* bar*, cl(psgc) bootcluster(id_tanod) seed(1989) reps(150)
	eststo: cgmwildboot tanod_interactS log_geodist tnd* bar*, cl(psgc) bootcluster(id_tanod) seed(1989) reps(150)
	eststo: cgmwildboot tanod_knowS log_geodist tnd* bar*, cl(psgc) bootcluster(id_tanod) seed(1989) reps(150)
	*esttab using "TabTanoddyadicS_boot.tex", se star(* .10 ** .05 *** .01) nodep r2 keep(log_geodist) mtitle("Trust" "Report" "Fair" "Interact" "Know") label title(Family Ties and Citizen Perceptions of Tanods\label{tab:dyadicboot}) note(OLS with respondent and tanod clustered SE. 95% CI from bootstrapped SE in parentheses. Includes respondent and tanod fixed effects.) replace

use "Haim et al JOP Replication - Individual Level.dta", replace
	
*Table E.4
eststo clear
eststo: reg satis_tanod embeddegreetnd connectavecivtnd connect_embed embeddegreecap logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic distance, cl(psgc) 
eststo: reg satis_tanod embeddegreetnd connectavecivtnd connect_embed embeddegreecap logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic degree age education employedft resideyears religioncatholic sampleprimary sampleproxy distance, cl(psgc) 
eststo: ologit satis_tanod embeddegreetnd connectmincivtnd connectmin_embed logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic degree age education employedft resideyears religioncatholic sampleprimary sampleproxy distance, cl(psgc)
eststo: ologit satis_tanod embeddegreetnd connectavecivtnd connect_embed embeddegreecap connectavecivcap logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic degree age education employedft resideyears religioncatholic sampleprimary sampleproxy distance if inrange(embeddegreetnd,0,85.591), cl(psgc)
eststo: ologit satis_tanod embeddegreetnd connectavecivtnd connect_embed embeddegreecap connectavecivcap logavgpathlengthbgy numtanodsbgy c10population4 c10hhsize c10education c10catholic degree age education employedft resideyears religioncatholic sampleprimary sampleproxy distance if inrange(c10population4,0,.1969375), cl(psgc)
*esttab using "RobSatisOLS.tex", se star(* .10 ** .05 *** .01) order(embeddegreetnd connectavecivtnd connect_embed connectmincivtnd connectmin_embed) keep(embeddegreetnd connectavecivtnd connect_embed connectmincivtnd connectmin_embed embeddegreecap numtanodsbgy c10population4 c10hhsize c10education c10catholic) nodep mtitle("Full" "Full" "Full" "Embeddedness Outliers" "Population Outliers") label title(Heterogeneous Effects on Evaluations of Tanod Service Provision\label{RobSatisOLS}) note(1--2 OLS, 3--5 ordered logit. Barangay-clustered SE.) replace

reg satis_tanod c.embeddegreetnd##c.connectavecivtnd logavgpathlength numtanodsbgy c10population4 c10hhsize c10education c10catholic distance, cl(psgc)
qui margins, at(connectavecivtnd=(0(1)18) embeddegreetnd=14.1 (median) logavgpathlength numtanodsbgy c10population4 c10hhsize c10education c10catholic) saving(embeddegree10, replace)
qui margins, at(connectavecivtnd=(0(1)18) embeddegreetnd=64.5 (median) logavgpathlength numtanodsbgy c10population4 c10hhsize c10education c10catholic) saving(embeddegree90, replace)
combomarginsplot embeddegree10 embeddegree90, labels("Low Embeddedness" "High Embeddedness") recastci(rarea) xtitle("Social Distance to Tanods") ytitle("Satisfaction with Tanods") title("") xlabel(0(3)18) ylabel(-1(1)2)


